package FenxiaoService

import (
	"context"
	"gdshop-back-end-go/client-api/app/request/FenxiaoReq"
	toolsDb "gdshop-back-end-go/common/db"
	"gdshop-back-end-go/common/response"
)

func GoodsFollowDel(ctx context.Context, parames *FenxiaoReq.GoodsFollowDel) *response.JsonResponse {
	fuModel, err := GetFenxiaoUserModelByMemberId(ctx, int(parames.MemberId))
	if err != nil {
		return response.FailByRequestMessage(nil, err.Error())
	}
	_, err = toolsDb.GetUnSafaTableAddDeleteWhere(ctx, "fenxiao_goods_follow").Where(
		"fenxiao_user_id = ? AND goods_id IN (?)", fuModel.Id, parames.Ids).Delete()
	if err != nil {
		return response.FailByRequestMessage(nil, err.Error())
	}

	return response.SuccessByRequestMessage(nil, "成功")
}
